<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>get、set</title>
	<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
	<div id="app">
		{{fullName}}
	</div>
	<script>
		var vue = new Vue({
			el: "#app",
			data: {
				firstName: "xu",
				lastName: "chun",
			},
			computed: {
				fullName: {
					get: function() {
						return this.firstName + " " + this.lastName
					},
					set: function(value) {
						var strs = value.split(" ")
						this.firstName = strs[0]
						this.lastName = strs[1]
					}
				}
			}
		})
	</script>
</body>
</html>